#!/bin/sh

cur_path=$(cd `dirname $0`;pwd)
container=$1
image=$2
tar_name=$3
if [ "$3" == "" ]; then
  echo "$0 container image tar_name"
  echo "ex: $0 we-steel-ui chenjingdong/we-steel-ui:230704 we-steel-ui-230704"
  exit;
fi
docker stop ${container}
docker rm ${container}
docker rmi ${image}
docker load -i ${cur_path}/../docker-tars/${tar_name}.tar
ret=`echo $?`
if [ $ret -eq 0 ];then
 ${cur_path}/start.sh
fi